<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style type="text/css">
		#div1{
			width: 50px;
			height: 50px;
			position: absolute;
			background: red;
			border-radius: 50%;
		}
	</style>
	<script type="text/javascript" src='getPos.js'></script>
	<script type="text/javascript">
        
        function getPos(ev){
        	var scrollTop = document.documentElement.scrollTop||document.body.scrollTop;
        	var scrollLeft = document.documentElement.scrollLeft||document.body.scrollLeft; 
            
            return {x:ev.clientX+scrollLeft,y:ev.clientY+scrollTop};
        }


		document.onmousemove=function(ev){
			//v鼠标跟随提示
			var oEvent = ev||event;
			var oDiv=document.getElementById('div1');
            var Pos=getPos(oEvent);
            //可视区域的

			oDiv.style.left=Pos.x+'px';
			oDiv.style.top=Pos.y+'px';

		}
	</script>
</head>
<body style="height: 2000px;">
	<div id="div1"></div>
</body>
</html>